Progressive query computation using streaming architectures

ABSTRACT

The described implementations relate to processing of electronic data. One implementation is manifest as a technique that can include obtaining a relational query that references one or more data items and associating progress intervals with the data items. The technique can also include converting the relational query into a corresponding streaming query, and providing the streaming query and the data items with the progress intervals to a stream engine that produces incremental results of the query. For example, the progress intervals can be based on row numbers of a relational database table. The progress intervals can be used to define event lifetimes of streaming events that are provided as inputs to the stream engine.

PRIORITY

This Utility application claims priority from U.S. Provisional Application No. 61/671,038, filed Jul. 12, 2012, the contents of which are hereby incorporated by reference in their entirety.

BACKGROUND

Existing techniques for working with data tend to provide a satisfactory user experience in most cases. For example, a user interacting with a database may use a graphical user interface (GUI) to issue various queries to a back-end database. In many scenarios, the queries can be executed in short periods of time and the user can continue working with the database interactively. This is also the case for many development scenarios, e.g., a software developer may write various queries, test them against the database, and receive results in an interactive fashion. This facilitates query development because the software developer can revise a given query as needed if the query does not produce expected results.

However, for large data sets, existing techniques do not always provide a satisfactory user experience. For example, “big data” tools such as Apache™ Hadoop® enable analysis of massive amounts of data, but not necessarily in an interactive fashion. In a big data context, a given query may take a very long time to complete, perhaps even overnight. From the perspective of the software developer responsible for writing the query, it can be difficult to debug such queries efficiently because the software developer waits a long time until the query completes before evaluating the results for correctness.

SUMMARY

The above listed example is intended to provide a quick reference to aid the reader and is not intended to define the scope of the concepts described herein.

This document relates to processing of electronic data. One implementation is manifest as a technique that can include obtaining a relational query that references one or more data items and associating progress intervals with the data items. The technique can also include converting the relational query into a corresponding streaming query, and providing the streaming query and the data items with progress intervals to a stream engine that produces incremental results of the query. At least the associating can be performed by a computing device.

Another implementation is manifest as one or more computer-readable storage media comprising instructions which, when executed by one or more processing devices, cause the one or more processing devices to perform acts. The acts can include processing a relational query using a stream engine configured to process streaming queries, and updating an interface with incremental results produced by the stream engine.

Another implementation is manifest as a system that can include logic and at least one processing device configured to execute the logic. The logic can be configured to receive a first code entry, receive a second code entry that relies on results of the first code entry, and provide a visualization of progressive results of the first code entry and the second code entry.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying drawings illustrate implementations of the concepts conveyed in the present patent. Features of the illustrated implementations can be more readily understood by reference to the following description taken in conjunction with the accompanying drawings. Like reference numbers in the various drawings are used wherever feasible to indicate like elements. Further, the left-most numeral of each reference number conveys the figure and associated discussion where the reference number is first introduced.

FIG. 1 shows an exemplary system that can be configured to accomplish certain concepts in accordance with some implementations.

FIG. 2A shows an exemplary data table in accordance with some implementations.

FIG. 2B shows exemplary progress graphs that illustrate certain features that are consistent with some implementations of the present concepts.

FIGS. 3 and 4 show flowcharts for accomplishing certain concepts in accordance with some implementations.

FIGS. 5-15 show exemplary screenshots of graphical user interfaces that can be provided in accordance with some implementations.

DETAILED DESCRIPTION Overview

This discussion relates to electronic data processing, and more particularly to using electronic data processing to perform incremental computations on data. For example, the disclosed implementations can provide meaningful results for a relational query by performing the query over a partial data set. To do so, the disclosed implementations can introduce a notion of progress in association with data sets that may not have any explicit temporal meaning or ordering. In this manner, a stream engine can be configured to provide incremental results of the relational query.

The disclosed implementations also can be used to provide meaningful partial results to the composition of multiple relational queries. For example, consider a data set that indicates that users have received 1 million impressions of a particular online advertisement in a given day. The data set may indicate that, during that same day, the advertisement received 10,000 clicks for a click-through rate of 1%. One approach to determine the click-through rate is to run, to completion, a first relational query that computes the number of impressions during the full day. Next, one can run, to completion, a second relational query that computes the number of clicks for the full day, and divide the results of the second query by the first query.

However, this approach can involve waiting for both relational queries to fully complete. The disclosed implementations can offer partial, incremental results for the click-through rate, e.g., after 10% progress through both queries, the user can be provided with an associated click-through rate for the 10% of the data that has been processed. As progress continues, the partial results can be updated until the computations are fully completed. Also note that the queries can progress at different rates, e.g., the first query may be 20% complete and the second query only 10% complete. In this case, the user can be provided with results for 10% of the data, and thus may have a meaningful understanding of the average click-through rate without having to wait for a total number of clicks and/or impressions to be computed.

Network System Example

FIG. 1 shows an exemplary network system 100 in which the techniques introduced herein can be employed. As shown in FIG. 1, network system 100 includes a network 110 connecting numerous devices, such as a server 120 and various client devices 130, 140, and 150. The server can have logical components including a web service 121, a script storage 122, a database 123, a stream engine 124, and an adapter module 125. The server may implement the logical components using hardware resources 126 such as a processor 127, storage 128, and memory 129. It is to be understood that the database 123 need not necessarily be on the same physical machine as Server 120; indeed, database 123 may consist of a distributed database architecture, such as a Hadoop® File System or Microsoft SQL Azure®, which consists of a network of databases. The client devices may have logical components such as interface modules 131, 141, and 151, and associated hardware resources 132-135, 142-145, and 152-155. Further details regarding hardware resources are provided later in this document. The immediately following discussion focuses on processing performed by the logical resources of the server and the client devices, e.g., components 121-125, 131, 141, and 151.

In some implementations, the interface modules 131-151 are web browsers that communicate with web service 121. For example, the interface modules can be HTML5 browsers that render commands and received updates and also send the commands to the web service. In other implementations, however, the interface modules can be dedicated or custom applications instead of web browsers. Further implementations may use browser plug-ins or other techniques to implement interface functionality described herein.

For example, users at the client devices 130-150 may submit source code, such as scripts, to the web service via the respective interface modules. The script storage 122 can be configured to store some or all of the received source code. Generally, the source code can be written to query the database 123, which can be a relational database (e.g., SQL) with data represented in tabular form. For example, the source code can be general-purpose code with integrated relational queries, or the source code can be directly written in a query language.

The stream engine 124 can be configured to perform processing on streaming data that is associated with explicit temporal data, e.g., data events with start times, end times, and/or durations. Notably, the data items in database 123 do not necessarily have any explicit temporal data or temporal ordering, and indeed can be randomly ordered. The adapter module 125 can be configured to adapt the data in the database so that the data can be processed by the stream engine. For example, the adapter module can obtain data items (e.g., rows of a table) from the database, create temporal data, associate the temporal data with the data items, and provide the data items to the stream engine as streaming events with the temporal data. The stream engine can then process the streaming events using one or more streaming query operators to produce incremental results.

Stream Engine Details

In a conventional database context, relational queries such as SQL queries can be used to build and manipulate tables for offline analysis. A contrasting approach is to use a stream engine that is designed for processing streaming events in real time. One example of a stream engine suitable for use with the disclosed implementations is Microsoft StreamInsight®, although other stream engines can also be used. Generally speaking, stream engines such as StreamInsight® are configured to receive streaming data events and continually output results that represent analysis of the data over a moving temporal window. For example, a stream engine can be configured to provide a moving average of the stock price for a given company over the past 5 days. As another example, a stream engine can be configured to compute an average temperature from a temperature sensor over a window of 5 minutes. Stream engines can thus implement streaming, continuous queries over changing data streams, in contrast to the static queries performed by a conventional database.

One differentiating feature between stream engines and conventional relational databases is that stream engines rely on a notion of temporality. This is because streaming events can be associated with explicit timestamps (example, the timestamp at which a particular activity occurred) and generally are valid for a given window of time, e.g., five days ago until present in the stock price example and 5 minutes ago until present in the temperature example. Thus, stream engines may rely on a notion of data “expiring” in the sense that the data is no longer valid for the query—data 6 days old or 6 minutes old in the previous examples is not considered by the stream engine when calculating current results. In contrast, a typical relational query may map query results to an entire data set, without any notion of progress or windows of validity of the data stored therein. Further, the data itself may be atemporal in nature, with tuples that are not necessarily associated with specific points in time.

Generally speaking, the adapter module 125 can introduce a notion of temporality into data for the purpose of processing a relational query using stream engine 124. For example, in the aforementioned click-through example, each group of 100 users in the data set may represent one processing interval. By treating the users as explicit progress points for the stream engine, the stream engine can be leveraged to provide partial, meaningful results to one or more relational queries. Some implementations may adapt data for processing by a stream engine by defining temporal windows of validity in association with each interval, as discussed more below. Note that with this formulation, the streaming engine may be unaware that it is being used to process an atemporal relational query.

Example Data

FIG. 2A illustrates an exemplary relational data table 200 that can be employed in some implementations. Data table 200 includes N rows of data related to flight information, such as might be employed by an airline or travel service. Data table 200 includes a row number column 201, a day of week column 202, a flight number column 203, an airport column 204, and a delay column 205. Each row ID corresponds to a particular data item, in this case, a particular flight on a particular day. For example, table 200 shows that flight 936 was delayed 14 minutes in one instance (row 2) and 18 minutes in another instance (row 6). Note that the row number column may serve as a primary key in this example, e.g., to differentiate different instances of the same flight number. Also, note that there is no inherent temporal order to the data in the data table, i.e., the table does not specify that any of the delays happened before or after one another. Thus, the data items in the data table are not configured for processing by a conventional stream engine.

Now, consider a user that wishes to know the average flight delays for different days of the week. Further, assume that N is a very large number, perhaps in the millions or even greater. Using a conventional relational query, one approach to provide the user with an answer would be to build a query plan (e.g., tree) of operators such as SELECT, JOIN, etc. The query plan can read the entire data set of N rows and process them as a whole to produce an output that gives the requested average delays for each day of the week. This can take a substantial amount of time depending on the amount of data to be processed, available processing resources, etc.

Note, however, that it is unlikely that all of the data really needs to be processed before meaningful conclusions can be derived. For example, processing only 10,000 of the rows may provide statistically meaningful information on average flight delays for different days of the week. Using a conventional relational query, however, the user will need to wait for the entire data table 200 to be processed before being given a query result.

To provide meaningful intermediary results to such a query, a conventional stream engine can be used in some implementations. However, as mentioned above, conventional stream engines are generally configured to process data items with limited lifetime windows that are defined based on temporal values associated with the data items. In some implementations, the adapter module 125 may provide the row ID of a given data item to the stream engine 124 as a temporal attribute of each data item. Thus, from the perspective of the stream engine that is processing data table 200, row 1 begins at time 1, row 2 begins at time 2, row 3 begins at time 3, etc. The stream engine can increment a “tick” or time counter each time a given row is processed. In a sense, this amounts to reusing the notion of application time in a stream engine by setting the application to a progress time. Here, progress time represents progress through the data set towards a final state when all of the data items have been processed. Note, however, that row ID is just one example of a domain over which progress can be defined.

Furthermore, note that a conventional stream engine may process data items that have both a beginning and an end time, e.g., the windows of 5 days, 5 minutes, etc. In this case, however, the user wants an average over all of the data items and thus does not necessarily want individual rows to “expire.” In other words, the user wants all of the data values in the table 200 to contribute to the final results. The adapter module 125 can accomplish this by creating a stream event for each data item in the data table and setting the end lifetimes of the stream events so that the events do not end, e.g., by setting the end times to infinity. In other words, the adapter module can create an input event to the stream engine that includes data from row 1, begins at time 1, and ends at time infinity. Likewise, the adapter module can create another input event to the stream engine that includes data from row 2, begins at time 2, and ends at time infinity. More generally, the adapter module can convert each row of the data table to an input event that starts at a time defined by the row number and ends at infinity. Note, however, that other time windows for the events are feasible depending on the specifics of the query, as discussed more below.

Thus, one approach that allows the application of streaming operators of a stream engine to conventional data is to define some progress attribute that can be used by the stream engine to process individual data items. In the example above, the progress attribute was row ID and the progress was explained on a row-by-row basis. Further implementations may define progress at different levels of granularity. For example, every 3 rows of data in table 200 can be considered a progress point.

This is illustrated at FIG. 2B, which shows a progress graph 250 that represents progress on a row-by-row basis and a progress graph 260 that shows progress based on progress intervals whose left endpoints move forward every 3 rows. In this example, the stream engine 124 can process rows in groups of 3 and output a new set of results for each group. In other words, the first set of results produced by the stream engine would represent the average flight delays for the first 3 records, the second set of results produced by the stream engine would represent the average flight delays for the first 6 records, the third set of results would represent the average flight delays for the first 9 records, and so on. Note also that the value 3 was chosen to provide for compact illustration in FIG. 2B, and many different values can be used, e.g., progress can be defined on an arbitrary number of records.

From a conceptual perspective, each progress interval represents a “snapshot” of time from the perspective of the stream engine. The stream engine can execute streaming operations such as selects, projects, joins, etc., using streaming counterpart operations to traditional relational queries. Each streaming operation can operate on an individual snapshot of data at a single time.

To configure the input events, the adapter module 125 can use an AlterLifetime operation of the stream engine. In this case, parameters of the AlterLifetime operation can be used to (1) set the start timestamp for each event and (2) set the duration for each event. In the example above, the first 3 events (for the first 3 data items) could be set with a start time of 1 and a lifetime of infinity, the next 3 events with a start time of 2 and a lifetime of infinity, the next 3 with a start time of 3 and a lifetime of infinity, and so on. From this perspective, rows 1-3 contribute to the results from time 1 through infinity, rows 4-6 contribute to the results from time 2 to infinity, etc. Some implementations can also define lifetimes at different granularities as rows are processed. For example, results can be provided every 100 records for the first 10,000 records to give the user relatively quick feedback, and thereafter records can be processed in sets of 1,000. Each individual event in a given set of events can have the same lifetime and contribute to the results from the beginning of their lifetime.

Thus, in the current example, a streaming SELECT operation to obtain delay times for Mondays can operate on a first set of events for the first three rows at the first snapshot, a second set of events for the first 6 rows at the second snapshot, and so on, as well as for the other days of the week. Averages can be computed on individual snapshots in a like manner. In this fashion, the original relational query is progressively performed on larger and larger sets of data until all the data has been processed and a final state has been reached. At this point, the final results output by the stream engine can be identical to those that would be output by a conventional relational database. In other words, once the stream engine time ticks to the end time of the events, the entire data set contributes to the answer as in a conventional SQL query.

Thus, the streaming operations implemented by the stream engine can be viewed as progressing through a series of progress points. The progress points can be viewed as a monotonically increasing ordered domain. Note that the above discussion refers to “infinity” as an example end lifetime of certain rows. In this context, “infinity” means the final progress point of the stream engine for a given data set. Thus, a data item with an end lifetime of infinity is a data item that contributes to the final result.

In some implementations, the web service 121 may obtain incremental results of the computations from the stream engine 124 and send the incremental results to any of the client devices 130-150 for display by the respective interface modules 131-151. Further implementations may process additional queries that depend on the results of previous queries that are currently progressing. For example, a first query may produce results that are used as an input to a second query. The first query can proceed up to a first progress interval, and the second query can begin processing using partial results of the first query up to the first progress interval. In this fashion, a pipeline of incremental results can be fed from one query to another. In turn, users at the client devices can be provided with visualizations of the incremental results for multiple dependent queries, as discussed in more detail below.

Query Progress

The disclosed implementations can be performed in view of the insight that temporal semantics of a stream engine can correspond directly to the notion of progressive computations for relational queries. As mentioned above, this can be implemented by using the application time notion of the stream engine to denote progress. This is possible because the semantics of progressive results are analogous to the semantics that a stream engine uses with time in order to compute streaming query results over real-time data streams.

Considered more formally, each individual tuple (e.g., row) is associated with a progress interval [LE, RE). Here LE refers to the left endpoint of the interval, whereas RE refers to the right endpoint of the interval. These intervals split the progress domain into distinct snapshots, where a result can be obtained at each snapshot. The union of these endpoints forms the set of “progress points” of the input to a stream engine.

The progress points can be used to define progressive output for a query Q as follows. First, each input tuple can have an assigned progress interval. Next, for every unique progress point p across all progress interval endpoints in the input data, there exists a set O_(p) of output results with progress intervals that are “stabbed” by p. Here, the term “stabbed” implies that the progress point p includes all of the progress intervals that contain progress point p within the interval, e.g., for an interval [LE, RE) then p lies within LE and RE. The output of the streaming query O_(p) can be defined to be exactly the result of the query Q evaluated over input tuples with progress intervals that are stabbed by p.

Given an ordered list of progress points p₀, p₁, . . . and so on, the progressive (or incremental) result of the input relational query as of progress point p_(i) is the result of the streaming query on the data that is associated with (or is “live” at) p_(i). The progressive result of progress point p_(i) can be computed incrementally from the computation and/or result associated with the previously computed progress point p_(i-1). Each progressive result tuple is itself associated with a progress interval so that progressive queries can be composed across operators.

Example Method

FIG. 3 shows an example method 300 that can be applied to adapt relational queries for use by a stream engine. For example, method 300 can be performed by the adapter module 125. However, some or all of the functionality described herein with respect to the adapter module can be performed by different modules or devices, e.g., by modifying stream engine 124, by performing processing at the client devices, etc.

At block 301, a relational query is obtained. For example, the adapter module may receive a relational query over the network. As another example, the adapter module can receive script code that identifies the relational query. In either case, the source of the relational query can be a user entering source code into the interface module 131.

At block 302, progress intervals are associated with data items that are referenced by the relational query. For example, each row ID of a table can be assigned a different progress interval, or multiple rows of a table can be grouped into sets where each set has an assigned progress interval.

At block 303, the relational query is converted into a corresponding streaming query. For example, the relational query can be a SQL query and the stream engine can implement streaming versions of the SQL query.

At block 304, events are provided to a stream engine. For example, an event can be generated for each row of the table and the time intervals of the events can be set to the progress intervals that were associated with the rows at block 302.

At block 305, incremental results can be obtained from the stream engine. For example, the adapter module can obtain the results and, as they are obtained, provide them to the user by sending them over the network to one or more of the client devices.

Generally, blocks 304 and 305 can continue iterating until the entire table has been processed. Then, at block 306, final results can be obtained from the stream engine and provided to the client devices as discussed above.

Queries on multiple tables can be performed as described above. For example, each table can have its own set of progress intervals, such that progress intervals are compatible across tables and indicate similar notions of underlying progress. For example, a click table and impression table may have tuples that are assigned the same progress intervals for identical sets of users actions that resulted in the clicks and impressions. The assignment of progress intervals gives end users (or automated progress assignment modules between the user and the system) significant flexibility in defining what progress means to their specific application.

Furthermore, using the disclosed techniques, it is possible to provide deterministic behavior. In other words, because explicit progress intervals are associated with individual data items in the table, there is one particular progressive result associated with any given progress point for a particular data set. Likewise, this provides precise data-dependent query semantics for the progressive results, because changing the input data has a specific effect on the progressive results that can be recomputed for any given progress point.

In addition, the disclosed implementations provide a provenance quality for progressive results. For any given progressive result, the adapter module 125 can be configured to determine the set of data items that were used to compute the progressive result. The stream engine can do so by determining the progress interval for a given progressive result. This is possible because each progress interval corresponds to an identifiable (e.g., unique) set of data items.

In some implementations, the adapter module 125 can be configured to identify, for any given result, the particular data items that contributed to that progressive result and provide them to the user. For example, a user debugging a given query can be provided with all of the data items that contribute to the first progress interval for a given query. This enables the user to check the correctness of the query using alternative mechanisms such as computing expected results of the query manually.

Query Pipelines

Method 300 can be used to pipeline partial, incremental query results from one query to another. For example, incremental results output at block 305 for a first query can be input to a second query. Thus, incremental results can be obtained for the second query as well.

FIG. 4 illustrates a flow chart of an exemplary query pipeline 400. First, a user enters a first code entry 401. Code entry 401 can be source code that is used to derive a relational query that is subsequently converted to a streaming query. Incremental results 402 of the streaming query are output by the stream engine 124. Here, progressive results 402 represent heights of individuals named Bob, Joe, Richard, and Samuel, with heights of 60, 64, 75, and 73 inches, respectively.

Next, the user provides a second code entry 403. Code entry 403 is used to derive a second relational query that is subsequently converted to a second streaming query. Second incremental results 404 of the second streaming query are output by the stream engine 124. Here, the second incremental results 404 represent heights of individuals over 72 inches, which include Richard and Samuel.

Next, the user provides a third code entry 405. Code entry 405 is used to derive a third relational query that is subsequently converted to a third streaming query. Third incremental results 406 are output by the stream engine. Here, the third progressive results represent name lengths of individuals over 72 inches tall, e.g., 7 and 6 for Richard and Samuel, respectively.

One consequence of pipelining query results in this fashion is that the user can receive feedback from a first query and then decide what code to enter based on the feedback. This ongoing feedback can be received as long-running computations continue to progress. Furthermore, users can stop computations before they complete, e.g., if the results appear to indicate some logical error in the code.

Memory Overhead

Stream engine 124 may be configured to operate entirely in main memory and produce incremental results to streaming queries. For each incoming event, the stream engine can check if the query result needs to be updated as a result of the event, and if yes, can produce an output event immediately. In order to accomplish this, the continuous queries can be compiled into a graph of incremental operators that process incoming events in a push-based manner, i.e., for every incoming event, they update some internal in-memory state and produce output events that reflect the change to the operator result as a result of processing that data. As mentioned, stream engines are generally configured to operate over bounded temporal windows of data. Thus, the stream engine can clean up internal state when it is no longer needed, e.g., the stream engine can clean up input events and intermediate results that will no longer contribute to new results.

A consequence of using an in-memory stream engine to process data without enforcing bounded windows (e.g., end time of infinity) is that internal state may need to be maintained. For example, in the case of a join, the last data item in a left side input table may join with the first item on the right side input table. As a result, memory usage can monotonically increase over the lifetime of the streaming query. However, note that some interactive streaming queries do not necessarily run to completion and thus memory usage is not necessarily an issue in practice.

Some streaming queries may have characteristics that allow memory overhead to be reduced substantially. For example, consider the case where the progress attribute is the same as (or correlated with) the partitioning attribute. A query may be computing the average click-through-rate per user in a log of ad clicks and impressions. Assume that each row of the log is used as an event, the progress attribute uses rows of the log, and users appear in multiple rows that are scattered throughout the table. Since the stream engine 124 can encounter a given user at any row in the table, then the stream engine maintains a counter for every user in the table until a final state is reached.

However, consider the case where progress can be performed on a per-user basis. For example, the records for each user can be grouped together in the table. In this case, when the stream engine progresses to the next user, the stream engine 124 will no longer see any events for the previous user(s). Thus, the stream engine can clean up counters for previously-processed users by deleting them from memory. The stream engine can persist the click-through rate for that user (an incremental result) in storage and/or by sending the incremental results to one or more client devices.

In some implementations, the adapter module 125 can cause the stream engine 124 to perform cleanup by putting an AlterLifetime before the query is executed. The AlterLifetime call can change the progress endpoint of each user to be one chronon (or “tick”) in duration, so that the events representing the users expire instead of lasting for “infinity.” Thus, when the stream engine moves to the next user, the stream engine can automatically forget the state associated with the previous user.

Using the above technique can reduce memory utilization of the stream engine 124, but without more, the stream engine may delete results as well as intermediate states. Thus, the adapter module 125 can also configure the stream engine to retain results while still cleaning up intermediate state. To do so, the adapter module can perform another AlterLifetime call to set the progress endpoint back to the original value of the lifetime before the first AlterLifetime was performed, e.g., infinity or another value sufficient to persist the results until they are no longer needed. This technique can be done automatically using properties that indicate the connection between progress and partitioning.

As a short example, consider a data table with 6 entries indicating which animals given users have on a farm. The table can include 6 records as follows: {(Steve, Horse), (Steve, Cow), (Steve, Dog), (Bob, Chicken), (Bob, Pig), (Joe, Donkey)}. Now, consider a query on this table to count the number of different animals on each farm. The lifetimes of the input events can be set so that the records for Steve begin at 0 and end at 1, Bob's records begin at 1 and end at 2, and Joe's records begin at 2 and end at 3. Lifetimes for the results for the query that counts the number of records (e.g., output events) are persisted until the entire table is processed, e.g., by setting the lifetimes of the results to end at infinity. In this example, the user identifiers are used as a progress attribute instead of using the row numbers. This works semantically in this context because the query is aggregating information on a user-by-user basis.

The above technique can leverage physical storage locations of records on a storage device. For example, in a table ordered by user id, the physical location of the individual records on the storage device may correspond to the order in which the records will be processed by the stream engine. Thus, some implementations allow the individual records to be read from storage in the order they physically appear in storage.

Example Graphical Interfaces

The code entries mentioned above can be provided to the adapter module 125 and/or stream engine 124 by various local and/or remote user interfaces. Likewise, incremental results can be output using different remote and/or local user interfaces. The following discussion illustrates some exemplary graphical interfaces that can be used in conjunction with the adapter module and stream engine. However, note that the following interfaces are suitable for use with techniques for obtaining incremental query results other than those discussed herein. Generally, the graphical interfaces discussed below can be provided by web service 121 to the client devices 130-150, and displayed by the corresponding interface modules 131-151.

FIG. 5 illustrates an exemplary graphical user interface (GUI) 500. GUI 500 includes a scripts tab 501 that allows a user to see various existing scripts that are saved on server 120 in script storage 122. Here, the user has selected a script entitled “How long are search words?” Responsive to the user selection, GUI 500 is updated to show previously-entered script code in code section 510 and previously-obtained results in results section 520. For example, the previous code and results can relate to a previous scripting session and can be obtained from script storage 122.

Code section 510 includes 2 individual code entries 511 and 512, and corresponding results in results section 520. Thus, the 2 code entries collectively comprise the script “How long are search words?” and the associated results collectively comprise results of the script. Here, the results include a table that represents the latest 10 values of the variable “data”.” As line 511 progresses, result table 521 will be repeatedly updated with a new ten values. The results of script entry 512 include a histogram showing word lengths of the words. Result histogram 522 will be updated incrementally as the query continues on. Generally speaking, GUI 500 gives the user the ability to enter code, receive incremental results, save the code and associated results, and retrieve them later.

Thus, in some implementations, code and/or associated results and visualizations are automatically persisted after a given scripting session. This allows users to reenter the scripting session as of a previous state. Each scripting action, such as creating, deleting, or editing a script, can be stored in the script storage 122. When a user accesses the web service 121, the user may see their available scripts and script contents up to the last recorded change.

The web service 121 can also store summaries of the results of each of the code entries as the results are computed. This means that the results of a given code entry can outlast the scripting session itself. In some implementations, the GUI 500 uses a different background to distinguish scripts where there is an ongoing session (“live” scripts) from those whose scripting session previously ended (“dead” scripts). A refresh button or other interface element can be provided to revive dead scripts. Some implementations may time out script sessions after a given period of inactivity, e.g., 20 minutes.

Because users have the ability to overwrite and delete code entries and the results of overwritten/deleted code entries are persisted, some issues can arise. For example, consider a user that enters:

int x=3;

-   -   x=x+1;

and then deletes the second line of code in the GUI and replaces it as follows:

int x=3;

-   -   int y=x;

After the user clicks enter, the second line is evaluated and the variable x is updated to equal 4. When the user deletes the increment operation on x, some implementations do not necessarily undo its effects in the corresponding scripting session. Note, however, that the user can hit the refresh button to re-run both code entries and give y the expected value of 3. Some implementations may maintain data dependencies needed to visually distinguish results whose values would be different if the refresh button were hit. For example, data items that would change on a refresh operation can be highlighted or otherwise distinguished from other data values.

As a consequence of storing scripts in a central database and hosting scripting sessions on a central server, multiple people can work concurrently on the same scripting session from different client devices. The web service can asynchronously contact each client device about changes to the database to keep each user's view up to date. As mentioned previously, each scripting action can be tagged, by the web service, with the user ID of the person who took the action. For example, in FIG. 5, to the left of each command are the initials of the person who last edited that command (RD). This allows the user viewing the interface to understand what her teammates are up to and to share their results as they work. Other teammates may choose to copy a script to a new page to explore other queries.

Further implementations may provide for the peer-to-peer and master/apprentice styles of collaboration. In such implementations, the functionality discussed with respect to the server 120 herein can be performed by a single peer or distributed across multiple peers. Some scripts may be provided as multimedia documents, including formatted natural language text, images, audio annotations, and sticky-note annotations. Further implementations can provide export paths so that visualizations in the scripting environment can be readily saved in alternative formats. For example, some implementations may produce .jpg images, .pdf files, PowerPoint® slides, etc., directly from the GUI 500.

First Example Script and Results

FIG. 6 illustrates code section 510 and results section 520 of GUI 500 in another configuration where the user is processing height data in a script entitled “Explore Data.” Other portions of GUI 500 are omitted from FIG. 6 due to space constraints. As mentioned, users can enter code into code section 510, e.g., here the user has entered “HeightData” which refers to a variable defined in the scripting environment. For example, HeightData may have been defined in a previously-executed line of code that is no longer shown, or otherwise defined as a data source. HeightData may be an array of doubles representing various heights of people, and can be obtained from various data sources such as a relational data table. Here, once the user enters “HeightData,” the scripting interface is automatically populated with a visualization such as histogram 621. Thus, simply by clicking “enter” after typing HeightData, the user is immediately presented with the histogram. This can relieve the user of the burden of actively requesting visualizations and instead promote interactivity of the user experience. A histogram is merely for example; other visualizations that represent aggregate information may also be provided.

Histogram 621 can include a bin size slider 622. By adjusting the bin size, the user can see how the data groups at different levels of granularity. Considering FIG. 6 with a bin size of 1, each bar in the histogram represents an individual data item. By moving the slider to change the bin size to 8, the histogram can be updated so that 8 individual data items fall in each bin, as shown in FIG. 7. Note that by changing the bin size, the data begins to more clearly resemble a typical distribution than was the case when the bin size was 1.

FIG. 8 shows code section 510 and results section 520 in a configuration where the user has entered two more lines of code. First, the user populates a value “avg” with a scalar value for the average of the height data. In this case, the scalar value is displayed in a decimal representation in the results section 520, e.g., approximately 66.4. More generally, decimal representations or other numeric formats may be used to display scalar values in results section 520.

Next, the user can enter another line of code to create a variable called “talls” that includes the entries from HeightData that are greater than the average height. Another histogram 821 is presented in the results portion when the user enters the line of code, this time the histogram represents the variable “talls.” The histogram can be initially presented with a bin size of 1 as shown by slider 822. FIG. 9 shows results section 520 in a configuration where the user has updated the bin size to 8. Here, the histogram now looks more like the right half of a typical statistical distribution.

As mentioned, the results section 520 can continue to be updated as incremental processing is performed. Thus, both histograms 621 and 821 can continue to update as further data items are processed by the stream engine. This enables the user to work with and see visualizations of the data in a single interface even before the queries being processed have fully completed.

Note that some implementations may involve configuring the stream engine 124 differently depending on the bin size. For example, the bin size may default to 1, and the stream engine can begin processing data items individually. Next, the user can adjust the slider to a value of 5, and then can subsequently adjust the slider to a value of 7. Each time the user moves the slider, the interface module 131-151 can generate events that contain the value of the slider as payload. When the value changes, the previous event can be configured to end and a new event can be provided to the stream engine.

For example, consider when the user moves the slider from 1 to 5. The interface module 131 can create an event with payload “5” and lifetime from [start_time=0] to [end_time=infinity], indicating that slider value is 5. Next, assume the user adjusts the slider at progress point 20 to a bin size of 7 instead. Two events are sent to the stream engine, (1) an end event that ends the previous slider value: payload=5, start time=0, new end time=20, old end time=infinity, and (2) a start event that starts a new slider value: payload=7, start time=20, end time=infinity.

Now, the stream engine 124 uses these events to change the grouping condition for the histogram to the newer value. For example, the histogram may be generated by a group and apply operation which would now have a different (more coarse-grained) grouping condition. For example, the grouping key might go from floor(user/5) to floor(user/7). This, in turn, would transition the histogram bins from a width of 5 users to a width of 7 users. Prior to the transition, users 0-4 are in bin 0, users 5-9 are in bin 1, users 10-14 are in bin 2, and so on. After the transition, users 0-6 are in bin 0, users 7-13 are in bin 1, and so on.

Second Example Script Code and Results

FIGS. 10-12 show code section 510 and results section 520 of GUI 500 for a different set of code entries of a script entitled “Word Length Distribution.” In FIG. 10, a user named RD has entered a first line of code “var data=StreamAccess.GetDataStreamQ;” that populates a variable “data” with rows from a table. Here, the table includes search terms entered by users, e.g., from a search engine. The first 10 entries of the current progress interval are shown in the results section 520, e.g., the rows shown are the rows of the table for the most recent set of results. Note the user RD may be at a different client device and the initials are displayed to let other uses know which user entered that particular line of code.

In FIG. 11, another user (e.g., the local user) enters a second line of script code “var lens=data.Select(d=>d.word.Length);” that populates an array “lens” with lengths of the words from the variable “data.” A histogram 1121 is displayed with an associated slider 1102. FIG. 12 shows results section 520 updated at a later time when more results have been processed. Note histogram 1121 can automatically adjust scales of both the x and y axis to accommodate results as they are processed, e.g., the scales shown in FIG. 12 can be adjusted relatives to the scales shown in FIG. 11.

Additional Histogram Implementations

FIG. 13 illustrates an exemplary GUI 1300 that can be used in accordance with the disclosed implementations. GUI 1300 includes a configuration portion 1310 and a histogram portion 1320. The configuration portion includes options to configure how the histogram portion appears. For example, the user can stop processing of the query at any time, can configure a confidence interval using a slider 1311, and can configure a processing increment using a slider 1312. Effects of changing the confidence interval and the processing increment are discussed in more detail below. The configuration portion also gives a current sample size which indicates a number of data items that have been processed and a completed percentage that indicates the percentage of the data items that have already been processed.

GUI 1300 is shown in a configuration where the user has entered code with an integrated relational query that processes data such as that shown in table 200, e.g., flight delay data. Here, histogram portion 1320 shows individual columns representing delays for each day of the week, starting with Monday as day 1 and ending with Sunday as day 7. Although only 0.01% of the data has been processed, patterns are already beginning to emerge as Thursday and Friday (days 4 and 5) have noticeably longer delays than the weekend days (6 and 7).

FIG. 14 shows GUI 1300 at a later time, after processing 3,000 rows of data. Here, it is becoming apparent that Friday delays are the longest, with Thursday a close second. FIG. 15 continues with the example, showing GUI 1300 after processing 36,000 rows of flight data. Now it is clear that the weekend days have the shortest delays, on average.

By presenting incremental results as shown in FIGS. 13-15, the user is able to see relatively quickly the relationship between different days of the week and airport delays. Here, the results over just the first 1,000 data items provide some meaningful understanding of the characteristics of the underlying data. Some implementations are tunable and allow the user to select, via the GUI 1300, how often a partial result is computed. Compare FIGS. 13 and 14 and note the user has adjusted the Increment slider 1312 to change the number of rows that contribute to each incremental result. This can cause the adapter module 125 to change the lifetime of the underlying data items.

For example, if 10,000 records have been processed at a granularity of 1,000 records per tick, then the tick counter in the stream engine may have a current value of 10. Now, when the interval is set to 11,000, the next tick value of 11 will mean 11,000 more records have been processed—a total of 21,000. In other words, records 10,001 through 21,000 are processed at tick 11. Accordingly, the adapter module 125 can set the lifetime of records 21,000-31,999 to begin at 11 and end at infinity, the lifetime of records 32,000-43,999 can be set to begin at 12 and end at infinity, and so on. Now, the user will receive updates less frequently but each update will correspond to relatively larger subsets of data contributing to the results. In this sense, the user can “tune” the processing to receive results at a preferred level of granularity.

Also, note that histogram portion 1320 can represent confidence intervals using circles 1321. The circles represent upper and lower bounds of confidence of the query results as set by confidence slider 1311. As the confidence intervals change, the y-axis of the histogram can change scale to fit the confidence results within the histogram portion. Thus, the confidence interval gets progressively narrower from FIGS. 13 to 15 as the y-axis scale becomes smaller and smaller. This is because the confidence interval itself becomes smaller as more and more data items are processed. Some implementations use dataset minima and maxima as well as already observed variance to calculate these confidence bounds and display these on the visualizations. Aggregations such as sums and means can be updated and the confidence bounds can narrow as server updates are received.

Programming Implementations

Generally, the graphical interfaces discussed herein can interact with the server 120 to provide a unified scripting environment that enables users to interactively process large amounts of data. One specific implementation uses language-integrated query (“LINQ”) techniques to incorporate queries (e.g., SQL) into a general-purpose programming language such as C#. The code entries shown above generally illustrate this technique. In some implementations, the client devices 130-150 use Hypertext Markup Language (HTML), asynchronous JavaScript® and Extensible Markup Language (XML), and/or other technologies to communicate with the web service 121.

Referring back to the GUI 500 as shown in FIG. 5, the GUI can be used to provide a two-column read-eval-print loop (REPL), where code section 510 includes the left column of the REPL and results section 520 includes the right column of the REPL. In the left column, the user types commands (C# statements or expressions); in the right column, the client device displays the command result. The client device can send these commands to the server for evaluation when the user presses “enter” and receive incremental results from the server as they are computed by the stream engine 124.

Some of the commands entered in code section 510 can include LINQ code that identifies one or more relational queries. For example, consider code entry 512 in FIG. 5. Here, the language “d.word.Length” can be regarded a SELECT operator that is implemented using a streaming select operation. For each incoming event (e.g., row) the streaming select operation selects the word length attribute. Note in this instance that the “Pick” operator can be regarded as a user-defined operator.

Each code entry can have associated results of different types. In the case where the result is a simple scalar, the client device can draw a print string in the result section 520. However, when the result is a more complex object, the client device can choose a default visualization for the data: for tabular data, a table for streams of numbers, a histogram for streams of pairs of numbers, a scatter plot; etc. In any event, the user can be provided with the default visualization simply by entering a query that produces a result. If the default visualization does not fit the user's needs, the user can interactively switch the visualization type and change its parameters. For example, the user may be able to interactively switch between histograms and scatterplots via one or more drop-down menus or other selection options.

In some implementations, script commands are automatically rewritten by either the interface modules 131-151 or the web service 121. For example, when a script accesses an enumeration (IEnumerable<T> in .NET), the enumeration can be wrapped in a data stream (CepStream<T> in StreamInsight®) suitable for processing by the stream engine 124. Every time unit, the web service 121 can report a summary of the results back to the client device as well as report overall progress. For data sources whose size is known, this can be reported as the percent completed; for other sources, the number of items processed.

Hardware Implementations

As mentioned earlier, system 100 is one example of a system in which techniques such as those discussed above can be performed. For example, other exemplary systems may perform some or all of the disclosed functionality on a single device. Furthermore, functional components such as an interface module, adapter module, stream engine, database, script storage, and/or web service can be implemented as software, hardware, and/or firmware. Processors can execute computer-readable instructions to provide any of the functionality discussed herein, e.g., method 300 and associated processing. Data and/or computer-readable instructions can be stored on memory and/or storage. The memory and storage can include any one or more of volatile or non-volatile memory devices, hard drive storage devices, and/or optical storage devices (e.g., CDs, DVDs etc.), flash storage devices, etc.

In some cases, the various functional components discussed herein can be installed on the associated client device or server during assembly or at least prior to delivery to the user. In other scenarios, functional components can be installed after delivery, such as a download available over network 110 and/or from a removable storage device. The functional components can be manifest as freestanding applications or services, individual application modules, as part of an operating system, etc.

It is also worth noting that in some instances, the client devices or server can comprise multiple computing devices or machines, such as in a distributed environment. In such a configuration, method 300 can be implemented using distributed processing across the multiple computing devices or machines. The terms “computer,” “client device,” “server,” and “computing device” as used herein can mean any type of device that has some amount of processing capability and/or storage capability. Generally, a “mobile device” refers to a computing device embodied in a form factor suitable for a user to carry on their person. A computing device can obtain computer-readable instructions that are stored on storage devices and/or memory devices. Also, note that the term “system” can refer to a single device or multiple devices. Such devices can include various input/output mechanisms such as keyboards, displays, touchscreens (e.g., typing and/or gesture inputs), voice-activated interfaces, etc.

As used herein, the term “computer-readable media” can include signals. In contrast, the term “computer-readable storage media” excludes pure signals and implies some physical structure. Computer-readable storage media includes “computer-readable storage devices.” Examples of computer-readable storage devices include volatile storage media, such as RAM, and non-volatile storage media, such as hard drives, optical discs, and flash memory, among others.

In addition to the illustrated configurations of FIG. 1, computing devices consistent with the disclosed implementations can employ a system on a chip (SOC) type design. In such a case, functionality provided by the computer can be integrated on a single SOC or multiple coupled SOCs. One or more processors can be configured to coordinate with shared hardware, such as memory, storage, etc., and/or one or more dedicated hardware resources, such as hardware blocks configured to perform certain specific functionality. Thus, the term “processor” as used herein can also refer to controllers, microcontrollers, processor cores, or other types of processing devices suitable for implementation both in conventional computing architectures as well as SOC designs. In this context, the term “execute” in association with a processor/processing device can include functionality such as routing data and/or instructions to various dedicated hardware resources. The term “logic” encompasses both hardware modules and software instructions or modules.

CONCLUSION

The order in which the example methods are described is not intended to be construed as a limitation, and any number of the described blocks or acts can be combined in any order to implement the methods, or alternate methods. Furthermore, the methods can be implemented in any suitable hardware, software, firmware, or combination thereof, such that a computing device can implement the methods. In one case, the methods are stored on one or more computer-readable storage media as a set of instructions such that execution by one or more computing devices causes the one or more computing devices to perform the method.

Although techniques, methods, devices, systems, etc., discussed herein are described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described. Rather, the specific features and acts are disclosed as exemplary forms of implementing the claimed methods, devices, systems, etc. 

1. A method comprising: obtaining a relational query that references one or more data items; associating progress intervals with the data items; converting the relational query into a corresponding streaming query; and providing the streaming query and the data items with the progress intervals to a stream engine that produces incremental results of the query, wherein at least the associating is performed by a computing device.
 2. The method of claim 1, further comprising: receiving script code; and processing the script code to obtain the relational query.
 3. The method of claim 1, wherein the progress intervals are based on row numbers of a table storing the data items or the progress intervals are based on an attribute of the table.
 4. The method of claim 1, further comprising: obtaining another relational query that depends on the relational query; converting the another relational query to another streaming query; and providing the incremental results of the relational query as inputs to the another streaming query.
 5. The method of claim 1, further comprising: obtaining the incremental results from the stream engine; and updating a user interface as the incremental results are obtained.
 6. The method of claim 5, wherein updating the user interface comprises updating a visualization of the incremental results as the incremental results are obtained.
 7. The method of claim 6, wherein the visualization comprises a histogram and the updating comprises updating confidence intervals of the histogram as the incremental results are obtained.
 8. One or more computer-readable storage media comprising instructions which, when executed by one or more processors, cause the one or more processors to perform acts comprising: processing a relational query using a stream engine configured to process streaming queries; and updating an interface with incremental results produced by the stream engine.
 9. The one or more computer-readable storage media of claim 8, wherein processing the relational query using the stream engine comprises: converting the relational query to a corresponding streaming query; and executing the corresponding streaming query using the stream engine.
 10. The one or more computer-readable storage media of claim 8, the acts further comprising: obtaining multiple data items of a data table that is referenced by the relational query; creating events corresponding to multiple data items; and providing the events to the stream engine.
 11. The one or more computer-readable storage media of claim 8, the acts further comprising: setting different lifetimes for the events, wherein individual lifetimes correspond to progress intervals of the stream engine.
 12. The one or more computer-readable storage media of claim 11, the acts further comprising: setting different begin times for different sets of events, wherein the different begin times correspond to different progress intervals.
 13. The one or more computer-readable storage media of claim 12, the acts further comprising: setting a common end time for the different sets of the events, so that each of the different sets of events will contribute to a final result produced by the stream engine.
 14. A system comprising: logic configured to: receive a first code entry, receive a second code entry that relies on results of the first code entry, and provide a visualization of progressive results of the first code entry and the second code entry; and at least one processing device configured to execute the logic.
 15. The system of claim 14, wherein the visualization is provided responsive to a user entering the second code entry without the user explicitly requesting the visualization.
 16. The system of claim 14, wherein the logic is further configured to: obtain a first streaming query based on the first code entry and a second streaming query based on the second code entry, and provide the first streaming query and the second streaming query to a stream engine that produces the progressive results.
 17. The system according to claim 16, wherein the logic is further configured to: receive a user input to stop computation of the progressive results; and stop the stream engine from producing further progressive results when the user input is received.
 18. The system according to claim 16, wherein the logic is further configured to determine lifetimes of events and provide the lifetimes to the stream engine, wherein the lifetimes configure the stream engine to discard at least some internal state information after processing the events.
 19. The system of claim 14, wherein the logic is further configured to identify one or more input data items that contribute to the progressive results.
 20. The system according to claim 14, wherein the first code entry and the second code entry are entered during a scripting session and the logic is further configured to persist the scripting session in storage after the scripting session ends. 